﻿@model BskLeague.Models.News
           
@{
    ViewBag.Title = "Wiadomości :: " + @Model.newsTitle;
}

<p>@Html.ActionLink("Powrót do listy...", "Index")</p>

<h2>
    @Model.newsTitle
    @if (User.IsInRole("Admin"))
    {
        <a href='@Url.Action("Edit", new { id = @Model.newsId })'>
            <img src='../../Content/images/edit-icon.png' title='edytuj' alt='edytuj' />
        </a>
        <a href="javascript:if(confirm('Na pewno usunąć?')){window.location='/News/Delete/@Model.newsId'}">
            <img src='../../Content/images/delete-icon.png' title='usuń' alt='usuń' />
        </a>
    }
</h2>
<p class="news_category">@Model.newsCategory.categoryName</p>
<p class="news_list_date">@Model.newsDate</p>
<p>@Model.newsContent</p>

<a name="comments" id="comments"></a>
<h3>Komentarze (@Model.newsComments.Count())</h3>

<fieldset>
    @foreach (var comment in Model.newsComments)
    {
        <p>
            <strong>
                <a href="/../Players/Details/@comment.commentAuthor.PlayerId">@comment.commentAuthor.PlayerName @comment.commentAuthor.PlayerSurname</a> - @comment.commentDate
                @if (User.IsInRole("Admin"))
                {
                    <a href="javascript:if(confirm('Na pewno usunąć?')){window.location='/News/DeleteComment/@comment.commentId'}">
                        <img src='../../Content/images/delete-icon.png' title='usuń' alt='usuń' />
                    </a>
                }
            </strong>
        <br />@comment.commentContent</p>
    }
</fieldset>

<h3>Zostaw komentarz</h3>
<form action="../LeaveComment" method="post">
    <input type="hidden" value="@Model.newsId" id="newsId" name="newsId" />
    <fieldset>
        <table width="100%">
            <tr>
                <td>
                    @Html.TextArea("commentContent", null, new { @style = "width: 99%; height: 100px;" })
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value="Zapisz" />
                </td>
            </tr>
        </table>
    </fieldset>
</form>